import request from '@/utils/request'
import requestOver from '@/utils/requestOver'
// 首页 -----------------------------------------------------------
export function homeBarData() {
  return request({
    url: '/wms/home/barData',
    method: 'get'
  })
}
export function homeLineData() {
  return request({
    url: '/wms/home/lineData',
    method: 'get'
  })
}
// 订单管理导出
export function exportdeliveryExport(listQuery) {
  return request({
    url: '/wms/delivery/deliveryExport',
    method: 'get',
    params: listQuery,
    timeout: 0 // 设置永不超时
  })
}
// 仓库管理列表 -----------------------------------------------------------
export function warehouseShipmentList(listQuery) {
  return request({
    url: '/wms/warehouseShipment',
    method: 'get',
    params: listQuery
  })
}

// 获取仓库可关联入驻商列表
export function queryShipmentList(query) {
  return request({
    url: `/wms/warehouseShipment/shipments`,
    method: 'get',
    params: query
  })
}

// 确认选择的入驻商
export function chooseShipment(arr, useOms, warehouseCode) {
  return request({
    url: '/wms/warehouseShipment/choose',
    method: 'post',
    params: { codes: arr, useOms, warehouseCode: warehouseCode }
  })
}
// 删除
export function warehouseShipmentDelete(code) {
  return request({
    url: '/wms/warehouseShipment/' + code,
    method: 'delete'
  })
}

export function warehouseList(listQuery) {
  return request({
    url: '/wms/warehouse',
    method: 'get',
    params: listQuery
  })
}
// 启用
export function active(arr) {
  return request({
    url: '/wms/warehouse/active',
    method: 'put',
    params: { codes: arr }
  })
}
// 停用
export function unActive(arr) {
  return request({
    url: '/wms/warehouse/unactive',
    method: 'put',
    params: { codes: arr }
  })
}
// 新增
export function warehouseSubmit(data) {
  return request({
    url: '/wms/warehouse',
    method: 'post', data
  })
}
// 详情
export function warehouseDetail(code) {
  return request({
    url: `/wms/warehouse/${code}`,
    method: 'get'
  })
}
// 修改
export function warehouseEdit(data) {
  return request({
    url: '/wms/warehouse',
    method: 'put',
    data
  })
}
// 删除
export function warehouseDelete(code) {
  return request({
    url: '/wms/warehouse',
    method: 'delete',
    params: { codes: code }
  })
}
// 库区管理列表 -----------------------------------------------------------
export function warehouseSpaceList(listQuery) {
  return request({
    url: '/wms/warehouseSpace',
    method: 'get',
    params: listQuery
  })
}
// 启用
export function warehouseSpaceActive(arr) {
  return request({
    url: '/wms/warehouseSpace/active',
    method: 'put',
    params: { codes: arr }
  })
}
// 停用
export function warehouseSpaceUnActive(arr) {
  return request({
    url: '/wms/warehouseSpace/unactive',
    method: 'put',
    params: { codes: arr }
  })
}
// 新增
export function warehouseSpaceAdd(data) {
  return request({
    url: '/wms/warehouseSpace',
    method: 'post',
    params: data
  })
}
// 详情
export function warehouseSpaceDetail(code) {
  return request({
    url: `/wms/warehouseSpace/${code}`,
    method: 'get'
  })
}
// 修改
export function warehouseSpaceEdit(data) {
  return request({
    url: '/wms/warehouseSpace',
    method: 'put',
    params: data
  })
}
// 删除
export function warehouseSpaceDelete(code) {
  return request({
    url: '/wms/warehouseSpace',
    method: 'delete',
    params: { codes: code }
  })
}
// 所属仓库下拉框
export function getWarehouse() {
  return request({
    url: '/wms/warehouse/business/warehouse',
    method: 'get'
  })
}
// 调拨单审核 - 调入仓库 下拉数据源
export function transferToWarehouse() {
  return request({
    url: '/wms/warehouse/chooseData',
    method: 'get'
  })
}
// 所属库位下拉框
export function getLocation(warehouseCode, spaceCode, locationName) {
  return request({
    url: '/wms/location/chooseData',
    method: 'get',
    params: {
      'warehouseCode': warehouseCode,
      'spaceCode': spaceCode,
      'locationName': locationName
    }
  })
}
// 所属库位下拉框new
export function getLocationList(warehouseCode, locationName = '') {
  return request({
    url: '/wms/location/chooseData',
    method: 'get',
    params: {
      warehouseCode,
      locationName
    }
  })
}
// 所属库区下拉框
export function getWarehouseSpace(code) {
  return request({
    url: '/wms/warehouseSpace/chooseData',
    method: 'get',
    params: {
      'warehouseCode': code
    }
  })
}
// warehouseCode
export function getchooseAllData(code) {
  return request({
    url: '/wms/warehouseSpace/chooseAllData',
    method: 'get',
    params: {
      'warehouseCode': code
    }
  })
}
// 所属库位承载类型下拉框
export function getLocationBearType() {
  return request({
    url: '/wms/locationBearType/chooseData',
    method: 'get'
  })
}

// 库位承载类型列表 -------------------------------------------------------------------------------
export function locationBearTypeList(listQuery) {
  return request({
    url: '/wms/locationBearType',
    method: 'get',
    params: listQuery
  })
}

// 启用
export function locationBearTypeActive(arr) {
  return request({
    url: '/wms/locationBearType/active',
    method: 'put',
    params: { codes: arr }
  })
}
// 停用
export function locationBearTypeUnActive(arr) {
  return request({
    url: '/wms/locationBearType/unactive',
    method: 'put',
    params: { codes: arr }
  })
}
// 新增
export function locationBearTypeAdd(data) {
  return request({
    url: '/wms/locationBearType',
    method: 'post',
    params: data
  })
}
// 详情
export function locationBearTypeDetail(code) {
  return request({
    url: `/wms/locationBearType/${code}`,
    method: 'get'
  })
}
// 修改
export function locationBearTypeEdit(data) {
  return request({
    url: '/wms/locationBearType',
    method: 'put',
    params: data
  })
}
// 删除
export function locationBearTypeDelete(code) {
  return request({
    url: '/wms/locationBearType',
    method: 'delete',
    params: { codes: code }
  })
}
// 库位管理 -------------------------------------------------------------------------------
export function locationList(listQuery) {
  return request({
    url: '/wms/location',
    method: 'get',
    params: listQuery
  })
}
// 启用
export function locationActive(arr) {
  return request({
    url: '/wms/location/active',
    method: 'put',
    params: { codes: arr }
  })
}
// 停用
export function locationUnActive(arr) {
  return request({
    url: '/wms/location/unactive',
    method: 'put',
    params: { codes: arr }
  })
}
// 新增
export function locationAdd(data) {
  return request({
    url: '/wms/location',
    method: 'post',
    params: data
  })
}
// 详情
export function locationDetail(code) {
  return request({
    url: `/wms/location/${code}`,
    method: 'get'
  })
}
// 修改
export function locationEdit(data) {
  return request({
    url: '/wms/location',
    method: 'put',
    params: data
  })
}
// 删除
export function locationDelete(code) {
  return request({
    url: '/wms/location',
    method: 'delete',
    params: { codes: code }
  })
}
// 品牌管理 -------------------------------------------------------------------------------
export function brandList(listQuery) {
  return request({
    url: '/wms/brand',
    method: 'get',
    params: listQuery
  })
}
// 启用
export function brandActive(arr) {
  return request({
    url: '/wms/brand/active',
    method: 'put',
    params: { codes: arr }
  })
}
// 停用
export function brandUnActive(arr) {
  return request({
    url: '/wms/brand/unactive',
    method: 'put',
    params: { codes: arr }
  })
}
// 新增
export function brandAdd(data) {
  return request({
    url: '/wms/brand',
    method: 'post',
    params: data
  })
}
// 详情
export function brandDetail(code) {
  return request({
    url: `/wms/brand/${code}`,
    method: 'get'
  })
}
// 修改
export function brandEdit(data) {
  return request({
    url: '/wms/brand',
    method: 'put',
    params: data
  })
}
// 删除
export function brandDelete(code) {
  return request({
    url: `/wms/brand/${code}`,
    method: 'delete'
  })
}
// 单位管理 -------------------------------------------------------------------------------
export function goodsUnitList(listQuery) {
  return request({
    url: '/wms/goodsUnit',
    method: 'get',
    params: listQuery
  })
}
// 启用
export function goodsUnitActive(arr) {
  return request({
    url: '/wms/goodsUnit/active',
    method: 'put',
    params: { codes: arr }
  })
}
// 停用
export function goodsUnitUnActive(arr) {
  return request({
    url: '/wms/goodsUnit/unactive',
    method: 'put',
    params: { codes: arr }
  })
}
// 新增
export function goodsUnitAdd(data) {
  return request({
    url: '/wms/goodsUnit/save',
    method: 'post',
    params: data
  })
}
// 详情
export function goodsUnitDetail(code) {
  return request({
    url: `/wms/goodsUnit/${code}`,
    method: 'get'
  })
}
// 修改
export function goodsUnitEdit(data) {
  return request({
    url: '/wms/goodsUnit/update',
    method: 'put',
    params: data
  })
}
// 删除
export function goodsUnitDelete(code) {
  return request({
    url: '/wms/goodsUnit/batchdel',
    method: 'delete',
    params: { codes: code }
  })
}
// 批次规则管理 -------------------------------------------------------------------------------
export function batchRuleList(listQuery) {
  return request({
    url: '/wms/batchRule',
    method: 'get',
    params: listQuery
  })
}
// 启用
export function batchRuleActive(arr) {
  return request({
    url: '/wms/batchRule/active',
    method: 'put',
    params: { codes: arr }
  })
}
// 停用
export function batchRuleUnActive(arr) {
  return request({
    url: '/wms/batchRule/unactive',
    method: 'put',
    params: { codes: arr }
  })
}
// 新增
export function batchRuleAdd(data) {
  return request({
    url: '/wms/batchRule',
    method: 'post',
    params: data
  })
}
// 详情
export function batchRuleDetail(code) {
  return request({
    url: `/wms/batchRule/${code}`,
    method: 'get'
  })
}
// 修改
export function batchRuleEdit(data) {
  return request({
    url: '/wms/batchRule',
    method: 'put',
    params: data
  })
}
// 删除
export function batchRuleDelete(code) {
  return request({
    url: '/wms/batchRule',
    method: 'delete',
    params: { codes: code }
  })
}
// 商品管理 -------------------------------------------------------------------------------
export function goodsList(listQuery) {
  return request({
    url: '/wms/goods',
    method: 'get',
    params: listQuery
  })
}
// 商品类别
export function findByShipmentCode(code) {
  return request({
    url: '/wms/goodsType/findByShipmentCode',
    method: 'get',
    params: { shipmentCode: code }
  })
}
// 入驻商商品单位
export function findGoodsUnit(code) {
  return request({
    url: '/wms/goodsUnit/search',
    method: 'get',
    params: { shipmentCode: code, keywords: '' }
  })
}

// 商品类别删除
export function deleteGoodsType(code) {
  return request({
    url: `/wms/goodsType/${code}`,
    method: 'delete'
  })
}
// 商品类别新增
export function goodsTypeAdd(data) {
  return request({
    url: '/wms/goodsType',
    method: 'post',
    data
  })
}
// 商品类别编辑
export function goodsTypeEdit(data) {
  return request({
    url: '/wms/goodsType',
    method: 'put',
    data
  })
}
// 判断商品分类能否新增子节点
export function goodsTypeCanAdd(code, type) {
  return request({
    url: `/wms/goodsType/canAdd/${code}?type=${type}`,
    method: 'get'
  })
}

// 商品类别详情
export function goodsTypeDetail(code) {
  return request({
    url: `/wms/goodsType/${code}`,
    method: 'get'
  })
}

// 入驻商
export function findShipmentPartys() {
  return request({
    url: '/arpa-basic-api/party/wmsShipment',
    method: 'get'
  })
}
// 获取入驻商单位列表接口
export function findUnitByShipmentCode(code) {
  return request({
    url: '/wms/goodsUnit/findUnitByShipmentCode',
    method: 'get',
    params: { shipmentCode: code }
  })
}
// 获取入驻商批次列表
export function findBatchRuleByShipmentCode(code) {
  return request({
    url: '/wms/batchRule/findByShipmentCode',
    method: 'get',
    params: { shipmentCode: code }
  })
}
// 获取入驻商商品品牌列表
export function findBrandByShipmentCode(code) {
  return request({
    url: '/wms/brand/findByShipmentCode',
    method: 'get',
    params: { shipmentCode: code }
  })
}

// 启用
export function goodsActive(arr) {
  return request({
    url: '/wms/goods/active',
    method: 'put',
    params: { codes: arr }
  })
}
// 停用
export function goodsUnActive(arr) {
  return request({
    url: '/wms/goods/unactive',
    method: 'put',
    params: { codes: arr }
  })
}
// 新增
export function goodsAdd(data) {
  return request({
    url: '/wms/goods',
    method: 'post',
    data
  })
}
// 详情
export function goodsDetail(code) {
  return request({
    url: `/wms/goods/${code}`,
    method: 'get'
  })
}
// 修改
export function goodsEdit(data) {
  return request({
    url: '/wms/goods',
    method: 'put',
    data
  })
}
// 删除
export function goodsDelete(code) {
  return request({
    url: '/wms/goods/batchdel',
    method: 'delete',
    params: { codes: code }
  })
}
// 库存状态管理 -------------------------------------------------------------------------------
export function inventoryStatusList(listQuery) {
  return request({
    url: '/wms/inventoryStatus',
    method: 'get',
    params: listQuery
  })
}
//
export function inventoryRecordList(listQuery) {
  return request({
    url: '/wms/inventoryRecord',
    method: 'get',
    params: listQuery
  })
}
// 启用
export function inventoryStatusActive(arr) {
  return request({
    url: '/wms/inventoryStatus/active',
    method: 'put',
    params: { codes: arr }
  })
}
// 停用
export function inventoryStatusUnActive(arr) {
  return request({
    url: '/wms/inventoryStatus/unactive',
    method: 'put',
    params: { codes: arr }
  })
}
// 新增
export function inventoryStatusAdd(data) {
  return request({
    url: '/wms/inventoryStatus',
    method: 'post',
    params: data
  })
}
// 详情
export function inventoryStatusDetail(code) {
  return request({
    url: `/wms/inventoryStatus/${code}`,
    method: 'get'
  })
}
// 修改
export function inventoryStatusEdit(data) {
  return request({
    url: '/wms/inventoryStatus',
    method: 'put',
    params: data
  })
}
// 删除
export function inventoryStatusDelete(code) {
  return request({
    url: '/wms/inventoryStatus',
    method: 'delete',
    params: { codes: code }
  })
}

// 容器管理 -------------------------------------------------------------------------------
export function containerList(listQuery) {
  return request({
    url: '/wms/container',
    method: 'get',
    params: listQuery
  })
}
// 启用
export function containerActive(arr) {
  return request({
    url: '/wms/container/active',
    method: 'put',
    params: { codes: arr }
  })
}
// 停用
export function containerUnActive(arr) {
  return request({
    url: '/wms/container/unactive',
    method: 'put',
    params: { codes: arr }
  })
}
// 新增
export function containerAdd(data) {
  return request({
    url: '/wms/container',
    method: 'post',
    params: data
  })
}
// 详情
export function containerDetail(code) {
  return request({
    url: `/wms/container/${code}`,
    method: 'get'
  })
}
// 修改
export function containerEdit(data) {
  return request({
    url: '/wms/container',
    method: 'put',
    params: data
  })
}
// 删除
export function containerDelete(code) {
  return request({
    url: '/wms/container',
    method: 'delete',
    params: { codes: code }
  })
}
// 获取可用容器列表
export function containerCanUseList(receiveCode) {
  return request({
    url: '/wms/container/canUseList',
    method: 'get',
    params: { receiveCode: receiveCode }
  })
}

// 数据字典管理 -------------------------------------------------------------------------------
// 数据字典下拉框
export function getDictList(dictType) {
  return request({
    url: '/arpa-basic-api/dict/listDict',
    method: 'get',
    params: { types: dictType }
  })
}
export function getWmsFeeType() {
  return request({
    url: '/arpa-basic-api/dict/listDict',
    method: 'get',
    params: { types: 'wmsFeeType' }
  })
}

// 仓库合同管理 -------------------------------------------------------------------------------
export function contractList(listQuery) {
  return request({
    url: '/wms/contract',
    method: 'get',
    params: listQuery
  })
}
// 启用
export function contractActive(arr) {
  return request({
    url: '/wms/contract/active',
    method: 'post',
    params: { codes: arr }
  })
}
// 停用
export function contractUnActive(arr) {
  return request({
    url: '/wms/contract/unactive',
    method: 'post',
    params: { codes: arr }
  })
}
// 新增
export function contractAdd(data) {
  return request({
    url: '/wms/contract',
    method: 'post',
    data
  })
}
// 详情
export function contractDetail(code) {
  return request({
    url: `/wms/contract/${code}`,
    method: 'get'
  })
}
// 修改
export function contractEdit(data) {
  return request({
    url: '/wms/contract',
    method: 'put',
    data
  })
}
// 删除
export function contractDelete(code) {
  return request({
    url: `/wms/contract/${code}`,
    method: 'DELETE'
  })
}
// 仓库合同作业费管理 -------------------------------------------------------------------------------
// 新增
export function contractOperationCostAdd(data) {
  return request({
    url: '/wms/contractOperationCost',
    method: 'post',
    params: data
  })
}
// 详情
export function contractOperationCostDetail(code) {
  return request({
    url: `/wms/contractOperationCost/${code}`,
    method: 'get'
  })
}

// 店铺
export function shopGetList(data) {
  return request({
    url: `/wms/shop/list`,
    method: 'post',
    params: data
  })
}
// 店铺详情
export function shopGetDetail(code) {
  return request({
    url: `/wms/shop/${code}`,
    method: 'get'
  })
}
// 店铺修改
export function shopGetEdit(data) {
  return request({
    url: `/wms/shop`,
    method: 'put',
    data
  })
}
// 店铺添加
export function shopGetAdd(data) {
  return request({
    url: `/wms/shop/save`,
    method: 'post',
    data
  })
}

// 店铺删除
export function shopGetDel(code) {
  return request({
    url: `/wms/shop?codes=${code}`,
    method: `get`
  })
}
// 审核 - 店铺
export function shopAudit(data) {
  return request({
    url: `/wms/shop/audit`,
    method: 'put',
    data
  })
}
// 获取入驻商枚举
export function getShipments() {
  return request({
    url: `/wms/warehouseShipment/business/shipments`,
    method: 'get'
  })
}
//  快递模板类型下拉列表 /wms/Carrier/cloudprintStandardTemplates
// 列表 - 承运商
export function getCarrierType(params) {
  return request({
    url: `/wms/Carrier/cloudprintStandardTemplates`,
    method: 'get',
    params: params
    // params: { qimenKey: qimenKey, waybillCustomerCode: waybillCustomerCode, waybillPassword: waybillPassword, outerCode: outerCode }
  })
}
// 添加 - 承运商
export function carrierAdd(data) {
  return request({
    url: `/wms/Carrier/save`,
    method: 'post',
    data
  })
}
// 删除 - 承运商
export function carrierDel(code) {
  return request({
    url: `/wms/Carrier?codes=${code}`,
    method: `get`
  })
}
// 修改 - 承运商
export function carrierEdit(data) {
  return request({
    url: `/wms/Carrier`,
    method: 'put',
    data
  })
}
// 审核 - 承运商
export function carrierAudit(data) {
  return request({
    url: `/wms/Carrier/audit`,
    method: 'put',
    data
  })
}
// 详情 - 承运商
export function carrierDetail(code) {
  return request({
    url: `/wms/Carrier/${code}`,
    method: 'get'
  })
}

// 列表 - 承运商
export function carrierList(data) {
  return request({
    url: `/wms/Carrier/list`,
    method: 'post',
    params: data
  })
}
// /wms/msgLog 消息日志：
export function msgLog(parms) {
  return request({
    url: `/wms/msgLog?${parms}`,
    method: 'get'
  })
}
// /wms/msgLog 普通复核
export function ordinaryReview(code) {
  return request({
    url: `/wms/generalReview`,
    method: 'get',
    params: code
  })
}

// 普通复核更新复核数量
export function update(data) {
  return request({
    url: `/wms/generalReview`,
    method: 'post',
    data
  })
}
// 普通复核更新复核数量
export function queryListByVolumeForRegularReview(data) {
  return request({
    url: `/wms/packingMaterial/queryListByVolumeForRegularReview`,
    method: 'post',
    data
  })
}
// 普通复核 - 复核重置
export function recheckReset(deliveryCode) {
  return request({
    url: `/wms/generalReview/recheckReset?deliveryCode=${deliveryCode}`,
    method: 'post'
  })
}
// GET /列表 打印模板
export function cloudprintStandardTemplates(parms) {
  return request({
    url: `/wms/cloudprintStandardTemplates?${parms}`,
    method: 'get'
  })
}
// POST 新增
export function cloudprintStandardAdd(data) {
  return request({
    url: `/wms/cloudprintStandardTemplates`,
    method: 'post',
    data
  })
}
// PUT 编辑
export function cloudprintStandardEdit(data) {
  return request({
    url: `/wms/cloudprintStandardTemplates`,
    method: 'put',
    data
  })
}
// GET 详情
export function listTemplates(id) {
  return request({
    url: `/wms/cloudprintStandardTemplates/details/${id}`,
    method: 'get'
  })
}
// 删除
export function cloudprintStandardDelete(ids) {
  return request({
    url: `/wms/cloudprintStandardTemplates?ids=${ids}`,
    method: 'DELETE'
  })
}

// query爆品
export function queryHotReview(code) {
  return requestOver({
    url: `/wms/hotReview`,
    method: 'get',
    params: code
  })
}

// update爆品
export function updateHotReview(data) {
  return requestOver({
    url: `/wms/hotReview`,
    method: 'post',
    data
  })
}
// update爆品baocai
export function queryListByVolumeForHotReview(data) {
  return requestOver({
    url: `/wms/packingMaterial/queryListByVolumeForHotReview`,
    method: 'post',
    data
  })
}
// 新 数据导出任务列表 /report/exportTask
export function exportTaskList(listQuery) {
  return request({
    url: '/report/exportTask',
    method: 'get',
    params: listQuery
  })
}
// 导出 添加数据导出任务
export function exportTask(data) {
  return requestOver({
    url: `report/exportTask`,
    method: 'post',
    data
  })
}
// 启用
export function userActive(arr) {
  return request({
    url: '/arpa-basic-api/users/enable',
    method: 'post',
    params: { codes: arr }
  })
}
// 停用
export function userUnActive(arr) {
  return request({
    url: '/arpa-basic-api/users/disable',
    method: 'post',
    params: { codes: arr }
  })
}
// 获取资源树
export function resourcdTree(code) {
  return request({
    url: `/arpa-basic-api/users/resourcdTree/${code}`,
    method: 'get'
  })
}
// 账号授权
export function accountAuthorize(data) {
  return request({
    url: `/arpa-basic-api/users/authorize`,
    method: 'post',
    data
  })
}
// 系统管理/账号管理 修改获取详情
export function userLoginDetail(code) {
  return request({
    url: `/arpa-basic-api/users/${code}`,
    method: 'get'
  })
}
// 入驻商授权
export function getUserShipments() {
  return request({
    url: `/arpa-basic-api/users/shipments`,
    method: 'get'
  })
}
// 仓库授权
export function getUserWarehouses() {
  return request({
    url: `/arpa-basic-api/users/warehouses`,
    method: 'get'
  })
}
// 新增 账号管理
export function userAdd(data) {
  return request({
    url: '/arpa-basic-api/users',
    method: 'post',
    data
  })
}
// 编辑 账号管理
export function userEdit(data) {
  return request({
    url: `/arpa-basic-api/users/${data.phone}`,
    method: 'put',
    data
  })
}
// 承运商管理 - 关联店铺
export function shopList(listQuery) {
  return request({
    url: '/wms/shop/shopList',
    method: 'get',
    params: listQuery
  })
}
// 获取订单来源下拉列表
export function chooseSourcePlatformList() {
  return request({
    url: '/wms/delivery/chooseSourcePlatformList',
    method: 'post'
  })
}
